home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / NRPAS13 / COSFT.DEM < prev    next >
Text File  |  1991-04-29  |  1KB  |  65 lines

  1. PROGRAM d12r5(input,output);
  2. (* driver for routine COSFT *)
  3. LABEL 1,99;
  4. CONST
  5.    eps=1.0e-3;
  6.    np=16;
  7.    np2=18;   (* np2=np+2 *)
  8.    width=30.0;
  9.    pi=3.1415926;
  10. TYPE
  11.    gldarray=ARRAY [1..np2] OF real;
  12.    glyarray=gldarray;
  13. VAR
  14.    big,per,scal,small : real;
  15.    i,jj,j,nlim : integer;
  16.    data,size : gldarray;
  17.  
  18. (*$I MODFILE.PAS *)
  19. (*$I FOUR1.PAS *)
  20.  
  21. (*$I REALFT.PAS *)
  22.  
  23. (*$I COSFT.PAS *)
  24.  
  25. BEGIN
  26. 1:   writeln('period of cosine in channels (2-',np:2,')');
  27.    readln(per);
  28.    IF (per <= 0.0) THEN GOTO 99;
  29.    FOR i := 1 to np DO BEGIN
  30.       data[i] := cos(2.0*pi*(i-1)/per)
  31.    END;
  32.    cosft(data,np,+1);
  33.    big := -1.0e10;
  34.    small := 1.0e10;
  35.    FOR i := 1 to np DO BEGIN
  36.       IF  (data[i] < small) THEN small := data[i];
  37.       IF  (data[i] > big) THEN big := data[i]
  38.    END;
  39.    scal := width/(big-small);
  40.    FOR i := 1 to np DO BEGIN
  41.       nlim := round(scal*(data[i]-small)+eps);
  42.       write(i:4,' ');
  43.       FOR j := 1 to nlim+1 DO write('*');
  44.       writeln
  45.    END;
  46.    writeln('press RETURN to continue ...');
  47.    readln;
  48.    cosft(data,np,-1);
  49.    big := -1.0e10;
  50.    small := 1.0e10;
  51.    FOR i := 1 to np DO BEGIN
  52.       IF (data[i] < small) THEN small := data[i];
  53.       IF (data[i] > big) THEN big := data[i]
  54.    END;
  55.    scal := width/(big-small);
  56.    FOR i := 1 to np DO BEGIN
  57.       nlim := round(scal*(data[i]-small)+eps);
  58.       write(i:4,' ');
  59.       FOR j := 1 to nlim+1 DO write('*');
  60.       writeln
  61.    END;
  62.    GOTO 1;
  63. 99:
  64. END.
  65.